package br.com.leopard.erp.gym.ws.consulta.cep;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import com.google.gson.Gson;

public class LeitorJSONEndereco {

	public EnderecoWS getEndereco(InputStream content) throws IOException {

		BufferedReader streamReader;
		streamReader = new BufferedReader(new InputStreamReader(content, "UTF-8"));
		StringBuilder responseStrBuilder = new StringBuilder();

		String inputStr;
		while ((inputStr = streamReader.readLine()) != null) {
			responseStrBuilder.append(inputStr);
		}

		Gson ob = new Gson();
		
		return ob.fromJson(responseStrBuilder.toString(), EnderecoWS.class);
	}
}
